import {BaseModel} from "../BaseModel";

export class UserAuthBook extends BaseModel{

    constructor(){
        super();
        this.symbolName = "UserAuthBook";
        this.tableName = "t_user_auth_book";
        this.id = -1;//主键id，自动递增的int值
        this.userId = '';//用户id
        this.bookId = '';//书本id
        this.reverse1 = '';//备用字段1
        this.reverse2 = '';//备用字段2
    }

    dbMapper(){
        return {
            id: 'id',
            userId: 'user_id',
            bookId: 'book_id',
            reverse1: 'reverse1',
            reverse2: 'reverse2'
        }
    }

    /**
     * 输出转换
     * @param obj
     * @returns {Book}
     */
    mappingModel(obj){
        let userAuthBook = new UserAuthBook();
        userAuthBook.id = obj.id ? obj.id : ''
        userAuthBook.userId = obj.user_id ? obj.user_id : ''
        userAuthBook.bookId = obj.book_id ? obj.book_id : ''
        userAuthBook.reverse1 = obj.reverse1 ? obj.reverse1 : ''
        userAuthBook.reverse2 = obj.reverse2 ? obj.reverse2 : ''
        return userAuthBook;
    }

}
